Hệ thống quản lý phòng khám trực tuyến bằng PHP
1 <?php
2 error_reporting(E_ERROR | E_WARNING | E_PARSE);
3
4 if(!defined('datalist_db_encoding')) define('datalist_db_encoding', 'iso-8859-1');
5 if(function_exists('set_magic_quotes_runtime')) @set_magic_quotes_runtime(0);
6 ob_start();
7 $currDir = dirname(__FILE__);
8 include("{$currDir}/../db.php");
9 include("{$currDir}/../settings-manager.php");
10
11 // check if initial setup was performed or not
12 detect_config();
13 migrate_config();
14
15 $adminConfig = config('adminConfig');
16 include("{$currDir}/incFunctions.php");
17 @include_once("{$currDir}/../hooks/__global.php");
18 include("{$currDir}/../language.php");
19 include("{$currDir}/../defaultLang.php");
20 include("{$currDir}/../language-admin.php");
21
22 /* trim $_POST, $_GET, $_REQUEST */
23 if(count($_POST)) $_POST = array_trim($_POST);
24 if(count($_GET)) $_GET = array_trim($_GET);
25 if(count($_REQUEST)) $_REQUEST = array_trim($_REQUEST);
26
27 // check sessions config
28 $noPathCheck=True;
29 $arrPath=explode(';', ini_get('session.save_path'));
30 $save_path=$arrPath[count($arrPath)-1];
31 if(!$noPathCheck && !is_dir($save_path)){
32 ?>
33 <link rel="stylesheet" href="adminStyles.css">
34 <center>
35 <div class="alert alert-danger">
36 Your site is not configured to support sessions correctly. Please edit your php.ini file and change the value of <i>session.save_path</i> to a valid path.
37 <br><br>
38 Current session.save_path value is '<?php echo $save_path; ?>'.
39 </div>
40 </center>
41 <?php
42 exit;
43 }
44 if(session_id()){ session_write_close(); }
45 $configured_save_handler = @ini_get('session.save_handler');
46 if($configured_save_handler != 'memcache' && $configured_save_handler != 'memcached')
47 @ini_set('session.save_handler', 'files');
48 @ini_set('session.serialize_handler', 'php');
49 @ini_set('session.use_cookies', '1');
50 @ini_set('session.use_only_cookies', '1');
51 @header('Cache-Control: no-cache, no-store, must-revalidate'); // HTTP 1.1.
52 @header('Pragma: no-cache'); // HTTP 1.0.
53 @header('Expires: 0'); // Proxies.
54 @session_name('online_clinic_management_system');
55 session_start();
56
57
58 // check if membership system exists
59 setupMembership();
60
61
62 ########################################################################
63
64 // do we have an admin log out request?
65 if($_GET['signOut']==1){
66 logOutUser();
67 ?><META HTTP-EQUIV="Refresh" CONTENT="0;url=../index.php"><?php
68 exit;
69 }
70
71 // is there a logged user?
72 if(!$uname=getLoggedAdmin()){
73 // is there a user trying to log in?
74 if(!checkUser($_POST['username'], $_POST['password'])){
75 // display login form
76 ?><META HTTP-EQUIV="Refresh" CONTENT="0;url=../index.php?signIn=1"><?php
77 exit;
78 }else{
79 redirect('admin/pageHome.php');
80 }
81 }
82
83 ?>